package rongyao;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class test1 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] names = br.readLine().split(",");
        if (names.length == 0) {
            System.out.println("error.0001");
            return;
        }
        int max = 0, cur;
        List<String> res = new ArrayList<>();
        Map<String, Integer> map = new HashMap<>();
        for (String name : names) {
            if (!valid(name)) {
                System.out.println("error.0001");
                return;
            }
            cur = map.getOrDefault(name, 0) + 1;
            map.put(name, cur);
            if (max == cur) {
                res.add(name);
            }else if (max < cur) {
                max = cur;
                res.clear();
                res.add(name);
            }
        }
        res.sort(Comparator.naturalOrder());
        System.out.println(res.get(0));
    }
    public static boolean valid(String name) {
        char[] chars = name.toCharArray();
        if (!Character.isUpperCase(chars[0])) return false;
        for (int i = 1; i < chars.length; i++) {
            if (!Character.isLowerCase(chars[i])) return false;
        }
        return true;
    }
}
